using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Dao;
using Entities;
namespace Doctors_WebForum.Admin.UIControls
{
    public partial class LogsDetails : System.Web.UI.UserControl
    {
        private Log log;
        private LogData logData;

        public LogsDetails()
        {
            log = new Log();
            logData = new LogData();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["ID"];
            if (id != null)
            {
                log = logData.GetLogByID(Utility.ToInt(id));
                txtLogID.Text = log.LogID.ToString();
                txtLogDate.Text = log.LoggedDate.ToShortDateString();
                txtLogName.Text = log.LogName;
            }
        }
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Write("<script>window.close()</script>");
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string id = txtLogID.Text;
            if (id != null)
            {
                if (logData.DeleteByID(Utility.ToInt(id)) == true)
                {
                    lblMessage.Text = "<font style='color:red'>Delete suscess !</font>";
                    txtLogID.Text = "";
                    txtLogDate.Text = "";
                    txtLogName.Text = "";
                }
                else
                {
                    lblMessage.Text = "<font style='color:red'>Delete not success !</font>";
                }
            }
        }
    }
}